import request from '@/utils/request.js'

//用户注册
export function register(user) {
    return request.post('/user/register', user);
}

// 添加订单
export function addOrder(orderDTO) {
    return request.post('/user/addOrder', orderDTO);
}

// 分页查询订单，按时间降序
export function getOrderByTime(current, num) {
    return request.get(`/user/getOrderByTime/${current}/${num}`);
}
//获取用户信息
export function getUserInfo() {
    return request.get('/user/getUserInfoById');
}

// 分组查询订单
export function getOrderGroup(groupIds) {
    return request.post('/user/getOrderGroup', groupIds);
}

// 根据总价钱范围查询订单
export function getOrderByPriceScope(current, num, little, big) {
    return request.get(`/user/getOrderByPriceScope/${current}/${num}`, {params: {little, big}});
}

// 查询订单详细信息
export function getOrder(orderId) {
    return request.get(`/user/getOrder/${orderId}`);
}

// 根据产品名称模糊查订单
export function getOrderByProductName(productCurrent, productPageNum, productName) {
    return request.get(`/user/getOrderByProductName/${productCurrent}/${productPageNum}`, {params: {productName}});
}